﻿<UserControl 
    x:Class="TfsWorkbench.HierarchyUI.DisplayMode"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:Conterters="clr-namespace:TfsWorkbench.HierarchyUI.Conterters" 
    xmlns:UIElements="clr-namespace:TfsWorkbench.UIElements;assembly=TfsWorkbench.UIElements" 
    xmlns:Properties="clr-namespace:TfsWorkbench.HierarchyUI.Properties" 
    xmlns:PopupControls="clr-namespace:TfsWorkbench.UIElements.PopupControls;assembly=TfsWorkbench.UIElements" 
    xmlns:ValueConverters="clr-namespace:TfsWorkbench.UIElements.ValueConverters;assembly=TfsWorkbench.UIElements"
    xmlns:filterObjects2="clr-namespace:TfsWorkbench.UIElements.FilterObjects;assembly=TfsWorkbench.UIElements"
    mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="840"
    Name="PART_DisplayMode">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/ApplicationStyles.xaml"/>
                <ResourceDictionary Source="/TfsWorkbench.UIElements;Component/Resources/CommandButtonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Conterters:OrientationToBoolConverter x:Key="OrientationConverter" TrueOrientation="Vertical" />
            <ValueConverters:BoolToStringConverter x:Key="HideToggleConverter" FalseText="Childless Included" TrueText="Childless Excluded" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Border Style="{StaticResource MainBorderStyle}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Border Margin="0,0,0,2" Background="{DynamicResource ToolbarBackground}" Padding="10" CornerRadius="5" Effect="{DynamicResource DropShadowLevel1}">
                <WrapPanel Orientation="Horizontal">
                    <StackPanel Orientation="Horizontal" ToolTip="Scale hierarchy view.">
                        <TextBlock VerticalAlignment="Center" Margin="0,0,2,0"><Run Text="Scale:"/></TextBlock>
                        <Slider x:Name="PART_ScaleSlider" Width="125" Minimum="0.075" Maximum="2" Value="1" />
                    </StackPanel>
                    <filterObjects2:FilterTreeView 
                        Height="23"
                        x:Name="PART_FiltersControl"
                        FilterCollection="{Binding ElementName=PART_DisplayMode, Path=Filter}"
                        ToolTip="Select the hiearchy view root items."
                        Margin="2,0,0,0"
                        />
                    <PopupControls:ValueSelectorControl
                        Height="23"
						x:Name="PART_ViewFilter"
						ValueSelections="{Binding SelectedViews, ElementName=PART_DisplayMode}" 
						ValueSelectionChanged="OnFilterSelectionsChanged" 
						DisplayText="Selected Views"
                        ShowSelectAll="True"
                        Margin="2,0,0,0" 
                        ToolTip="Select which item relationship views are displayed."
                        />
                    <ToggleButton
                        Height="23"
                        Name="PART_ExludeEmptyViews"
                        IsChecked="{Binding ElementName=PART_DisplayMode, Path=IsExcludingEmptyViews, Mode=TwoWay}"
                        Margin="2,0,0,0"
                        ToolTip="Toggle the inclusion of views without child items."
                        >
                        <DockPanel>
                            <ContentControl IsTabStop="False" Template="{StaticResource FilterIconTemplate}" Margin="2" Foreground="{StaticResource ButtonNormalStroke}" Width="13" />
                            <TextBlock Text="{Binding ElementName=PART_DisplayMode, Path=IsExcludingEmptyViews, Converter={StaticResource HideToggleConverter}}" />
                        </DockPanel>
                    </ToggleButton>
                    <PopupControls:ValueSelectorControl
                        Height="23"
						x:Name="PART_StateFilter"
						ValueSelections="{Binding SelectedStates, ElementName=PART_DisplayMode}" 
						ValueSelectionChanged="OnFilterSelectionsChanged" 
						DisplayText="State Filter"
                        ShowSelectAll="True"
                        Margin="2,0,0,0" 
                        ToolTip="Select which item states are included in the hiearchy view."
                        />
                    <ToggleButton
                        Height="23"
                        Name="PART_Orientation"
                        IsChecked="{Binding ElementName=PART_DisplayMode, Path=Orientation, Mode=TwoWay, Converter={StaticResource OrientationConverter}}"
                        Margin="2,0,0,0"
                        ToolTip="Toggle the hierarchy layout orientation."
                        Content="{Binding ElementName=PART_DisplayMode, Path=Orientation, StringFormat={}Layout: {0}}"
                        />
                    <Button Click="ResetButtonClick" Style="{DynamicResource RefreshButtonStyle}" Content="Reset" ToolTip="Reset hierarchy view layout." Margin="2,0,0,0" />
                    <Button
                        Command="{x:Static UIElements:CommandLibrary.SystemShellCommand}"
						CommandTarget="{Binding RelativeSource={RelativeSource Self}}" 
                        CommandParameter="{Binding Source={x:Static Properties:Settings.Default}, Path=HelpPageUrl}"
                        Style="{DynamicResource QuestionButtonStyle}"
                        ToolTip="View the online guidance."
                        Margin="2,0,0,0"
                        />
                </WrapPanel>
            </Border>
            <Border Grid.Row="1" Margin="0,5,0,0">
                <Grid>
                    <TextBlock FontStyle="Italic" Foreground="{DynamicResource DisplayModeTextColour}">
                        <Run Text="Hint: Click the above 'Selected Root Items' button to choose the display items." />
                        <LineBreak />
                        <Run Text="To scale: Hold [Shift] and use scroll wheel. Hold [Ctrl] and drag to exclude child nodes." />
                    </TextBlock>
                    <ScrollViewer x:Name="PART_LayoutScroller" HorizontalScrollBarVisibility="Auto" PreviewMouseWheel="ScrollViewerPreviewMouseWheel" Background="#01ffffff">
                        <Canvas x:Name="PART_LayoutCanvas">
                            <Canvas.LayoutTransform>
                                <ScaleTransform ScaleX="{Binding Value, ElementName=PART_ScaleSlider}" ScaleY="{Binding Value, ElementName=PART_ScaleSlider}" />
                            </Canvas.LayoutTransform>
                        </Canvas>
                    </ScrollViewer>
                </Grid>
            </Border>
        </Grid>
    </Border>
</UserControl>
